package com.xnyzc.lhy.order.mapper.system;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.xnyzc.lhy.common.component.config.GlobalConfig;
import com.xnyzc.lhy.order.entity.system.OaSysUser;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 用户表 Mapper 接口
 * </p>
 *
 * @author lhy@xnyzc.com
 * @since 2019-07-24
 */
public interface OaSysUserMapper extends BaseMapper<OaSysUser> {

    /**
     * 查询用户管理列表
     *
     * @return
     */
    List sysUserList(GlobalConfig config);

    /**
     * 查询用户管理列表(分页)
     *
     * @return
     */
    List sysUserListPaging(GlobalConfig config);

    @Select("SELECT oa_sys_office.office_id " +
            "FROM oa_sys_user " +
            "LEFT JOIN oa_sys_office " +
            "ON oa_sys_user.office_id=oa_sys_office.office_id " +
            "WHERE oa_sys_user.sys_user_id=${userId}  AND oa_sys_user.deleted=0")
    /**
     * 检查该用户的权限-向供应商直接指派订单是地区公司的权限
     *
     * @param userId
     * @return
     */
    Long checkUserAuth(@Param("userId") Long userId);
}
